package com.gome.han.bigdata.spark.core.rdd.operation.transformation

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author Hanpeng
 * @date 2021/1/13 20:34
 * @description:
 */
object FilterOperation {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("Operator")
    val sc = new SparkContext(sparkConf)
    // TODO 算子 - filter
    val rdd = sc.makeRDD(List(1,2,3,4))
    //函数true  保留
    val filterRDD: RDD[Int] = rdd.filter(num=>num%2!=0)
    filterRDD.collect().foreach(println)
    sc.stop()
  }
}
